package com.itheima.filter;

import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;
import lombok.extern.slf4j.Slf4j;

import java.io.IOException;


//@WebFilter(urlPatterns = "/*")
@Slf4j
public class DemoFilter implements Filter {
    //过滤器方法，web服务器收到请求以后运行
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {

        //放行
        filterChain.doFilter(servletRequest, servletResponse);
    }

    //初始化方法，web服务器启动的时候运行一次
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        Filter.super.init(filterConfig);
    }

    //销毁方法，web服务器关闭的时候运行一次
    @Override
    public void destroy() {
        Filter.super.destroy();
    }
}
